package com.study.pre;

import java.io.File;
import java.io.FileFilter;

public class FileFilterDemo {


    /**
     * lambda 函数式  Java web 可读性好  java8 spark scala 大数据处理引擎 scala jvm java8 -> big data
     * @param args
     */
    public static void main(String[] args) {


        File file = new File("/Users/haoyitao/Documents/andy/horse/资料");


        FileFilter fileFilterDemoIn = new FileFilter(){
            @Override
            public boolean accept(File pathname) {

                if(pathname.getName().endsWith(".pptx")){
                    return true;
                }
                return false;
            }
        };

        File[] files = file.listFiles(fileFilterDemoIn);

        for (int i=0;i<files.length;i++){

            System.out.println(files[i].getName());
        }

        File[] files2 = file.listFiles((pathname)->{
            if(pathname.getName().endsWith(".pptx")){
                return true;
            }
            return false;
        });

        for (int i=0;i<files2.length;i++){

            System.out.println(files[i].getName());
        }

        // spring boot  java8
    }



}
